<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="download";
					document.fm.submit();
				}
			});
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="download";
					document.fm.submit();
				}
			});
			
			$('#btn-exportb').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="downloadb";
					document.fm.submit();
				}
			});
			$('#btn-exportd').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="downloadd";
					document.fm.submit();
				}
			});
			$('#btn-reset').click(function(){	
				location.href = document.fm.action;
			});
			
			$('#btn_search').click(function(){	
				document.fm.csv.value="";
				document.fm.submit();
			});
			
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			
			$('#year4').change(function(){
				var year4 = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
				$.get("mmap_week_ajax.php",{ y: year4,t : nowtime }, function(data){
					$("#week_cd").children().remove();
					$("#week_cd").append( data ); 
				});
			});	
		});
		
		function toPage(thepage) {
			document.fm.page.value =  thepage;
			document.fm.csv.value="";
			document.fm.submit();
		}
		
		function setSS( valcd, valnm ) {
			if (gPara == "shop") {
				document.fm.shop_cd.value = valcd;
				document.fm.shop_name.value = valnm;			
			}
			if (gPara == "mediaid") {
				document.fm.media_cd.value = valcd;
				document.fm.media_name.value = valnm;			
			} 
			$('#dialog').dialog("close");
		}
		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">

{{$menu}}
{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>地域広告マスター管理</h2>
			<ul class="submenu clearfix">
				<li>地域広告情報一覧</li>
				{{if $aokimenu[6].li.mareaad_form.auth }} <li><a href="mareaad_form.php">地域広告情報登録</a></li>{{/if}}
				{{if $aokimenu[6].li.mareaad_import.auth }} <li><a href="mareaad_import.php">基本情報CSV登録</a> </li>{{/if}}
				{{if $aokimenu[6].li.mareaad_shop_import.auth }} <li><a href="mareaad_shop_import.php">店舗情報CSV登録 </a></li>{{/if}}
				{{if $aokimenu[6].li.marea_index.auth }} <li><a href="marea_index.php">DNPエリアマスタ</a></li>{{/if}}
			</ul>
			<h3>地域広告情報一覧</h3>
			<form name="fm" id="fm" method="get" action="mareaad_index.php" >
				<input type="hidden" name="page" />
				<table class="formTable">
					<tbody>
						<tr>
							<th>エリア名</th>
							<td>
								{{ html_options id='area_cd' name='area_cd' options=$area selected=$forms.area_cd }}
							</td>
						</tr><tr>
							<th>媒体名</th>
							<td>
								<input type="text" name="media_name" class="text" value="{{ $forms.media_name }}" />
								<input type="hidden" name="media_cd"  value="{{ $forms.media_cd|escape }}" />
								<button type="button" id="mediaid" class="btn_search" rel="media"><span>参照</span></button>
							</td>
						</tr><tr>
							<th>店舗</th>
							<td>
								<input type="text" name="shop_name" value="{{ $forms.shop_name }}" class="text" />
								<input type="hidden" name="shop_cd"  value="{{ $forms.shop_cd|escape }}" />
								<button type="button" id="shop" class="btn_search" rel="shop"><span>参照</span></button>
							</td>
						</tr><tr>
							<th>配布日</th>
							<td>
								{{ html_options id='year4' name='year4' options=$year4 selected=$forms.year4 }} 年{{ $err.year4 }}
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ html_options id='week_cd' name='week_cd' options=$week  selected=$forms.week_cd }}{{ $err.week_cd }} 週
							</td>
						</tr><tr>
							<th>更新日</th>
							<td>
								<input type="text" name="upd_f" class="text_date" value="{{ $forms.upd_f }}" /> ～ 
								<input type="text" name="upd_t" class="text_date" value="{{ $forms.upd_t }}" />
							</td></tr>
					</tbody>
				</table>
				<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
			</form>
{{ if is_numeric($page.cnt) }}
{{ if $page.cnt > 0 }}
			<p class="message">{{ $page.cnt }}件の情報が見つかりました。</p>
			<p align="left">{{$pageing}}</p>
			<table id="search_result" class="sortable" >
				<thead>
					<tr>
						<th><h3>コード</h3></th>
						<th><h3>エリア名</h3></th>
						<th><h3>エリア部数</h3></th>
						<th><h3>配布エリア</h3></th>
						<th><h3>取扱業者</h3></th>
						<th><h3>媒体名</h3></th>
						<th><h3>配布日</h3></th>
						<th><h3>店舗数</h3></th>
						<th><h3>店舗部数<br>合計</h3></th>
						<th><h3>店舗/エリア<br>割合</h3></th>
	{{if $aokimenu[6].li.mareaad_form.auth }}
						<th><h3>基本<br>情報</h3></th>
						{{ if $notisg5 }}
						<th><h3>店舗<br>情報</h3></th>
						{{ /if }}
	{{ /if }}
					</tr>
				</thead>
				<tbody>
{{ $nowindex =0 }}
{{ foreach from=$data key=k item=v name="member" }}
					<tr class="{{cycle values=odd,mod name='member'}}">
						<td>{{ $v.id }}</td>
						<td>{{ $v.area_name }}</td>
						<td align=right>{{ $v.area_nums|number_format }}</td>
						<td>{{ $v.publish_area_name }}</td>
						<td>{{ $v.hand_name }}</td>
						<td>{{ $v.media_name }}</td>
						<td class="center">{{ $v.begin_date }}</td>
						
						<td align=right>{{ $v.shop_count|number_format }}</td>
						<td align=right>{{ $v.shop_nums|number_format }}</td>
						<td align=right>{{ $v.shop_rate }}</td>
	{{if $aokimenu[6].li.mareaad_form.auth }}
						<td class="center"><a href="mareaad_form.php?id={{ $v.id }}">[更新]</a></td>
						{{ if $notisg5 }}
						<td class="center"><a href="mareaad_form.php?id={{ $v.id }}&isshop=1">[更新]</a></td>
						{{ /if }}
	{{ /if }}
					</tr>
{{ /foreach }}
				</tbody>
			</table>
			<p align="right">{{$pageing}}</p>
				<p class="button">
					<button type="button" id="btn-exportb"  ><span>CSV基本情報</span></button>
				{{ if $notisg5 }}
					<button type="button" id="btn-exportd"  ><span>CSV明細情報</span></button>
					<button type="button" id="btn-export"  ><span>CSVダウンロード</span></button>
				{{ /if }}
				</p>
{{ else }}
<p class="message">条件にマッチする情報は見つかりませんでした。</p>
{{ /if }}
{{ else }}
	<p class="message">ここに検索結果が表示されます。</p>
{{ /if }}
<div id="dialog" >
</div>
		</div></div>
		{{ $footer }}
	</body>
</html>